﻿using System;
using System.Web.UI;

namespace Components.Data.Fields
{
  public class ImageField : Field
  {
    public String AlternateText
    {
      get
      {
        String[] input = Value.Split(new String[] { Delimiter }, StringSplitOptions.RemoveEmptyEntries);
        return input[1];
      }
      set
      {
        this.Value = ImageUrl + Delimiter + value;
      }
    }

    public String ImageUrl
    {
      get
      {
        String[] input = Value.Split(new String[] { Delimiter }, StringSplitOptions.RemoveEmptyEntries);
        return input[0];
      }
      set
      {
        this.Value = value + "|" + AlternateText;
      }
    }

    private const String Delimiter = "|";
  }
}